--幻境boss活动
--#include "data\functions\Boss\DreamLandBossCommon.lua" once
local npcId = 142
NpcDialog[npcId] = {}
local t = NpcDialog[npcId]

t.main = function(sysarg)
	local levelLimit = DreamLandBossConfig.level[2]
	local strColor1 = Lang.ScriptTips.Color_Greed
	if not Actor.checkActorLevel( sysarg, DreamLandBossConfig.level[2], DreamLandBossConfig.level[1] ) then
		strColor1 = Lang.ScriptTips.Color_Red
	end

	local strCond1 = string.format( Lang.ScriptTips.LevelLimitFormat, strColor1, levelLimit )
	local strCond  = strCond1
	-----------------
	local strDesc 		= ""
	local okBtn 		= ""			--{按钮;样式;按钮名;函数名;描述}
	local exchangeBtn 	= ""
	local strBtnList 	= ""

	strDesc 	=  Lang.ScriptTips.DreamLandBoss019

	exchangeBtn = "{btn;0;"..Lang.ScriptTips.ButtonExchangeOne..";%s;}"			--{按钮;样式;按钮名;函数名;描述}
	okBtn 		= "{btn;0;"..Lang.ScriptTips.ButtonExchangeTen..";%s;}"			--{按钮;样式;按钮名;函数名;描述}
	strBtnList 	= string.format(okBtn, "ExchangeTen") .. string.format(exchangeBtn, "ExchangeOne")

	------------------
	

	--local localFun = string.format("OpenView,%s,%d", enLinkBuyItemWnd, cfg.itemId)
	--strBtnList = strBtnList .. string.format(cfg.buyBtn, localFun)

	-----------------
	local pack = DataPack.allocPacket(sysarg, LogicCmd.npcDialogSys.sysID, LogicCmd.npcDialogSys.sub.sNpcDlgData)
	
	DataPack.writeUint64(pack, Actor.getNpc(sysarg))
	DataPack.writeByte(pack, NpcDialogType.GeneralNpcDlg)
	DataPack.writeString(pack, strCond)
	DataPack.writeString(pack, strDesc)
	DataPack.writeString(pack, strBtnList)
	DataPack.writeChar(pack, -1)
	DataPack.writeByte(pack, 0);
	DataPack.flush(pack)

	return str
end

--进入活动场景
t.ExchangeTen = function ( sysarg )
	if(Actor.checkActorLevel(sysarg, DreamLandBossConfig.level[2], DreamLandBossConfig.level[1])~=true)then
		return Actor.sendTipmsg( sysarg, string.format(Lang.ScriptTips.DreamLandBoss012,DreamLandBossConfig.level[2]), ttFlyTip )
	end

	local state = DreamLandBossExchange(sysarg, 2)

	if state then
		t.main(sysarg)
	end
end

t.ExchangeOne = function ( sysarg )
	if(Actor.checkActorLevel(sysarg, DreamLandBossConfig.level[2], DreamLandBossConfig.level[1])~=true)then
		return Actor.sendTipmsg( sysarg, string.format(Lang.ScriptTips.DreamLandBoss012,DreamLandBossConfig.level[2]), ttFlyTip )
	end

	local state = DreamLandBossExchange(sysarg, 1)

	if state then
		t.main(sysarg)
	end
end


